package com.fly;

import org.apache.commons.lang3.SystemUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@SpringBootApplication
public class TradingServiceApplication implements CommandLineRunner
{
    @Value("${server.port}")
    Integer port;
    
    public static void main(String[] args)
    {
        // 在你发起Http请求之前设置一下属性
        // System.setProperty("http.proxyHost", "127.0.0.1");
        // System.setProperty("http.proxyPort", "1080");
        SpringApplication.run(TradingServiceApplication.class, args);
    }
    
    @Override
    public void run(String... strings)
        throws Exception
    {
        if (SystemUtils.IS_OS_WINDOWS)
        {
            log.info("★★★★★★★★  now open Browser ★★★★★★★★ ");
            Runtime.getRuntime().exec("cmd /c start /min http://127.0.0.1:" + port);
        }
    }
}
